<template>
  <div class="student">
    <h2>学生姓名：{{name}}</h2>
    <h2>学生性别：{{sex}}</h2>
    <button @click="sendStudentName">点我传递学生姓名</button>
  </div>
</template>

<script>
export default {
  name: "ZiDingYiShiJianBangDingStudent",
  data() {
    return {
      name: 'JOJO',
      sex: '男'
    }
  },
  methods: {
    sendStudentName() {
      this.$emit('jojo', this.name)
    }
  }
}
</script>

<style scoped>
.student{
  background-color: chartreuse;
  padding: 5px;
  margin-top: 30px;
}
</style>
